class Result:
    def __init__(self,  data=None, message: str = '', code: int = 200):
        self.data = data
        self.message = message
        self.code = code

    def to_dict(self):
        return {
            'data': self.data,
            'message': self.message,
            'code': self.code
        }

    @staticmethod
    def success(data=None, code=200):
        return Result(True, data, code)

    @staticmethod
    def fail( code=400, data=None):
        return Result(False, data, code)

    def to_dict(self):
        return {
            'message': self.message,
            'code': self.code,
            'data': self.data
        }
